In a hospital and a pharmacy, it is necessary to precisely prepare a medicine based on a prescription. Hence, inspection of preparation of a medicine is carried out after the medicine is prepared. As the preparation operation of a medicine, a pill packaging machine first carries out a packaging operation for packaging different kinds of pills in a medical envelope which is a medical bag. As the inspection of preparation of a medicine, a pill inspection apparatus takes an image of the medical envelope and binarizes the shot images (taken pictures) and then, counts the number of pills existing in the binarized image, and inspects the pills.
As pills, there are translucent pills through which light can pass and opaque pills which block light.
Permeation rates of the translucent pills vary depending upon their kinds, and brightness values of the translucent pills on their images are also different from each other. Depending upon kinds of the translucent pills, brightness value distribution of translucent pills partially overlap brightness value distribution of a back ground. Therefore, it is difficult to precisely carry out the inspection.
FIG. 6 show a conceptual diagram and a shot image of transmission of a translucent pill when diffusion light is used as illumination.
As shown in FIG. 6(a), light which can be received by an imaging portion 11 is limited to light which moves along lines 35a, 35b, 35c, 35d, 35e, 35f and 35g. Light which passes through centers of translucent pills 22 straightly travels along the line 35d, and as the light comes close to an outer peripheral portion in the order of the lines 35c, 35b and 35a, refraction at the translucent pills 22 becomes large. If light irradiated from a light emitting portion 31 is diffusion light in this manner, since irradiation angles of light are various, light irradiated from the light emitting portion 31 reaches the imaging portion 11 at any angles of the lines 35a, 35b, 35c, 35d, 35e, 35f and 35g. Hence, pixels having low brightness values showing the translucent pills 22 are not produced, outlines of the translucent pills 22 are clearly shot on the transmission image which is acquired by the imaging portion 11.
When diffusion light is used as illumination, opaque pills 21 in a medical envelope 20 are clearly shot as shown in a transmission image in FIG. 6(b). However, light passes through a transparency film of the medical envelope 20 which becomes a back ground, and light also passes through the translucent pills 22 depending upon a permeation rate thereof. Hence, brightness values of the back ground and the translucent pill 22 become almost the same. Therefore, even if the binarization processing and edge extraction processing are carried out for the shot image, it is only possible to slightly extract only the outer periphery of the translucent pill 22, and it is difficult to clearly distinguish from the translucent pill 22 the back ground. In this case, it is difficult to adjust a threshold value by binarization of the shot image, and an outline of the translucent pill 22 is frequently cut. Further, if the shot image is subjected to smoothing processing to remove other noises, the outline of the translucent pill 22 is removed like the noises. Hence, even if imaging processing is carried out, it is not possible to detect as the translucent pill 22. Here, the back ground means a region where pills do not exist in the shot image, and is a region which passes through only the transparency film.
FIG. 7 show a conceptual diagram and a shot image of transmission of a translucent pill when parallel light is used as illumination.
In FIG. 7, to emit parallel light, an illumination portion 30 includes a parallel light converting portion 32 for converting diffusion light into parallel light and also includes a light emitting portion 31.
As shown in FIG. 7(a), if light irradiated from the illumination portion 30 is parallel light, since variation of irradiation angle is small, a location through which light cannot pass is generated in the translucent pill 22. Light having an angle which is close to the irradiation angle like the line 35d reaches the imaging portion 11. However, in the case of light having the angles like the lines 35a, 35b, 35c, 35e, 35f and 35g, since irradiation light which is irradiated from the parallel light converting portion 32 does not have an angle, light which enters the imaging portion 11 becomes weak, and a brightness value of the outer periphery of the translucent pill 22 becomes low.
Hence, as shown in FIG. 7(b), a brightness value of a center of the translucent pill 22 becomes high and a brightness value of the outer periphery becomes low. Therefore, an outline of the translucent pill 22 is clearly shot on the transmission image which is acquired by the imaging portion 11.
FIG. 8 is a diagram for explaining parallel light which is irradiated from an illumination portion.
As shown in FIG. 8, out of parallel light which is irradiated from the illumination portion 30, light (lines 36a, 36g) which passes through a medical envelope is not refracted and thus, such light straightly travels. However, out of light (lines 36b to 36f) which passes through a transparent pill, light which passes through the outer periphery of the translucent pill 22 is refracted significantly. Therefore, such light does not reach the imaging portion 11, and a brightness value of the outer periphery of the translucent pill 22 is lowered. On the other hand, in the case of light which passes through a location in the vicinity of the center of the translucent pill 22, since a degree of refraction thereof is small, the imaging portion 11 receives the light and a brightness value becomes high.
Here, since a refraction index is determined by curvature of the translucent pill 22, a brightness value of the outer periphery of the translucent pill 22 becomes low irrespective of a permeation rate of the translucent pill 22. By utilizing the fact that the brightness value of the outer periphery of the translucent pill 22 is lowered by the parallel light, it is possible to clearly distinguish the translucent pill 22 and the back ground from each other, and to precisely detect the translucent pill 22.
Irradiation of parallel light is described in patent document 1.